/*
    Copyright (c) 2009-10 Qtrac Ltd. All rights reserved.

    This program or module is free software: you can redistribute it
    and/or modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation, either version 3 of
    the License, or (at your option) any later version. It is provided
    for educational purposes and is distributed in the hope that it will
    be useful, but WITHOUT ANY WARRANTY; without even the implied
    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
    the GNU General Public License for more details.
*/

#include "statusbuttonbar.hpp"
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QHBoxLayout>
#include <QTimer>


StatusButtonBar::StatusButtonBar(QWidget *parent)
    : QWidget(parent)
{
    m_label = new QLabel;
    m_label->setFrameStyle(QFrame::StyledPanel|QFrame::Sunken);
    m_checkBox = new QCheckBox(tr("&Show Images"));
    m_buttonBox = new QDialogButtonBox;

    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(m_label, 1);
    layout->addWidget(m_checkBox);
    layout->addWidget(m_buttonBox);
    setLayout(layout);
}


void StatusButtonBar::showMessage(const QString &message,
        int timeoutMSec)
{
    m_label->setText(message);
    if (timeoutMSec)
        QTimer::singleShot(timeoutMSec, m_label, SLOT(clear()));
}
